package com.wtb.javatool.dao;

import com.wtb.javatool.entity.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

@Mapper
public interface ResourceMapper {

	List<Resource> selectResourceByCourseId(Integer course_id);

	String selectResourceTypeById(Integer resource_type_id);

	List<ResourceType> resourceTypeList();

	List<Resource> selectResourseByResourseTypeId(@Param("resource_type_id")Integer resource_type_id,@Param("course_id")Integer course_id);

    int uploadResource(Resource resource);

	Resource selectResourceDataByResourceId(Integer resource_id);

	List<Resource> selectResourseByResourseTypeIdList(@Param("resourceTypeIds")List<Integer> resourceTypeIds,@Param("typeCount")Integer typeCount,@Param("course_id") Integer course_id);

	Integer saveresourceFavorite(Favorite favorite);

	List<Favorite> listAllResourceFavorite(Favorite favorite);

	Integer saveResourceComment(Comment comment);

	List<Comment> listAllResourceComment(Comment comment);

	Integer addLearnersCount(Integer resource_id);

	Integer addCommentCount(Integer resource_id);

	Integer addTotalScore(Comment comment);

	Resource selectCommentCountandTotalScore(Integer resource_id);

	Integer addScore(Resource resource);

	Integer updateLikeCount(Integer resource_id);

	String selectUserNameByUserId(Integer user_id);

	void addResourceTypeMapping(@Param("resourceId") Integer resourceId, @Param("resource_type_id")Integer resource_type_id);

	Integer downloadResource(@Param("resource_id")Integer resource_id);

	List<Resource> selectResourceByName(@Param("resource_name")String resource_name,@Param("course_id")Integer course_id);
}
